﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CreditoAutorizado.Servico;

namespace CreditoAutorizado
{
    public partial class Logar : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void LinkButton4_Click(object sender, EventArgs e)
        {
            Response.Redirect(URLPages.CadastroUsuario);
        }

        protected void BtCadastrar_Click(object sender, EventArgs e)
        {
            RealizarLogin();
        }

        private void RealizarLogin()
        {
            Session["UsuarioLogado"] = Fachada.GetInstancia().ObterUsuarioPorEmailESenha(txtEmail.Text, txtSenha.Text);

            if (Session["UsuarioLogado"] != null)
            {
                Response.Redirect(URLPages.PainelControle);
            }
            else
            {
                
            }
        }
    }
}